from django.db import models

# Create your models here.
from django.db import models

class Course(models.Model):
    """课程"""
    name = models.CharField(max_length=100, verbose_name='课程名称')
    credit = models.FloatField(default=2, verbose_name='学分')
    description = models.TextField(blank=True, verbose_name='课程简介')
    teachers = models.ManyToManyField('teacher.Teacher',
                                      through='teacher_course_class.TeacherCourseClass',
                                      related_name='courses',
                                      verbose_name='授课教师')
    created_at = models.DateTimeField(auto_now_add=True, verbose_name='创建时间')

    class Meta:
        db_table = 'tb_course'
        verbose_name = '课程'
        verbose_name_plural = verbose_name

    def __str__(self):
        return self.name